﻿using System;

namespace AccessControl.Utility.Tools
{
    public class Shamsi
    {
        public static DateTime ThisYearStart()
        {
            var pcal = new FarsiLibrary.Utils.PersianCalendar();
            return pcal.ToDateTime(pcal.GetYear(DateTime.Now), 1, 1, 0, 0, 0, 0);
        }
        public static DateTime ThisYearEnd()
        {
            return NextYearStart().AddMilliseconds(-1);
        }
        public static DateTime LastYearStart()
        {
            var pcal = new FarsiLibrary.Utils.PersianCalendar();
            return pcal.ToDateTime(pcal.GetYear(DateTime.Now) - 1, 1, 1, 0, 0, 0, 0);
        }
        public static DateTime LastYearEnd()
        {
            return ThisYearStart().AddMilliseconds(-1);
        }
        public static DateTime NextYearStart()
        {
            var pcal = new FarsiLibrary.Utils.PersianCalendar();
            return pcal.ToDateTime(pcal.GetYear(DateTime.Now) + 1, 1, 1, 0, 0, 0, 0);
        }
        public static DateTime NextYearEnd()
        {
            var pcal = new FarsiLibrary.Utils.PersianCalendar();
            return pcal.ToDateTime(pcal.GetYear(DateTime.Now) + 2, 1, 1, 0, 0, 0, 0).AddMilliseconds(0);
        }
    }
}
